package com.yugao.fintech.antelope.gateway;

import com.yugao.fintech.antelope.base.config.core.ConfigFactory;
import com.yugao.fintech.antelope.base.model.enums.ConfigDefineEnum;
import com.yugao.fintech.antelope.system.model.ResourceSyncMQ;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import java.util.ArrayList;

@Component
public class GatewayRunner implements ApplicationRunner {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        ConfigFactory.addListenConfigs(ConfigDefineEnum.STORAGE);

        ResourceSyncMQ mq = new ResourceSyncMQ();
        mq.setRamModuleList(new ArrayList<>());
        // 初始化资源模块
        rabbitTemplate.convertAndSend(ResourceSyncMQ.EXCHANGE, ResourceSyncMQ.KEY_NOTICE_INIT, mq.toMessage());
    }
}
